<?php
      $name = $_POST['username'];
      $pass = $_POST['userpass'];

      # 1. 建立链接
      $con = mysql_connect("localhost", "root" , "123456");
      # 2. 选择数据库 
      mysql_select_db("gz2003");
      mysql_query("set names utf8");

      # 3. 写sql语句;
      $sql = "INSERT INTO `list1`(`username`, `password`) VALUES ('$name' , '$pass')";
      $result= mysql_query($sql);
      if(!$result){
            die("数据库语句错误".mysql_error());
       };
      mysql_close($con);
      if($result){
            echo "1"; //注册成功
        }else{
            echo "0"; //注册失败
        }
?>